<template>
    <div>
        <h3>标题</h3>
        <p class="subtitle"></p>
        <span>发表时间：</span>
        <span>点击： 0次</span>
        <hr/>

        <!-- 缩略图 -->
        <img class="preview-img" v-for="(item, index) in list" :src="item.src"  height="100" @click="$preview.open(index, list)" :key="item.src">
        <!-- 图片内容区域 -->
        <div class="content"></div>
        <!-- 放置一个现成的评论子组件 -->
        <comment :id="id"></comment>
    </div>
</template>
<script>
import comment from '../subcomponents/comment.vue'
export default {
    data(){
        return{
            id: this.$route.params.id,
            photoInfo:{},
            list:[]
        }
    },
    created(){
        // this.getPhotoInfo()
        // this.getPhotoSuo()
    },
    methods: {
        getPhotoInfo(){
            this.$http.get('api/getimageInfo'+ this.id).then(res=>{
                if(res.body.status==0){
                    this.photoInfo = res.body.message[0]
                }
            })
        },
        getPhotoSuo(){
            this.$http.get('api/getthumimages/'+this.id).then(res=>{
                if(res.body.status==0){
                    res.body.message.forEach(item => {
                        item.w=600;
                        item.h=400;
                    });
                    this.list = res.body.message
                }
            })
        }
    },
    components:{
        comment
    }
}
</script>
<style lang="sass" scoped>

</style>
